package com.ymanage.controller;

import java.util.List;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;

import com.ymanage.entity.Supplier;
import com.ymanage.service.SupplierService;

/**
 * 
 * <p>Title:SupplierController </p>
 * <p>Description:供应商控制层 </p>
 * <p>Project:yumi </p>
 * @author alen
 * @Version 1.0
 * @date 2017年8月28日 下午5:07:27
 */
public class SupplierController {

	@Autowired
	private SupplierService supplierService;
	
	/*供应商列表*/
	@RequestMapping("/supplier.do")
	public String supplier(HttpServletRequest request){
		
		List<Supplier> list = supplierService.list();
		request.setAttribute("", list);
		
		return "";
	}
	
	/*增加供应商*/
	@RequestMapping("/supplierAdd.do")
	public String supplierAdd(HttpServletRequest request,Supplier supplier){
		
		supplierService.add(supplier);
		
		return "";
	}
	
	/*修改供应商*/
	@RequestMapping("/supplierUpdate.do")
	public String supplierUpdate(HttpServletRequest request,Supplier supplier){
		
		supplierService.update(supplier);
		
		return "";
	}
	
	/*删除供应商*/
	@RequestMapping("/supplierDel.do")
	public String supplierDel(HttpServletRequest request,Supplier supplier){
		
		supplierService.del(supplier);
		
		return "";
	}	
	
}
